property

abstract fun <T> property(name: String): Optional<T>

Returns an Optional describing the value of the JavaScript object's property with the given name or an empty Optional if there is no such property or its value is undefined.

The type mapping rules are the following:

| JavaScript         | Java           |
|--------------------|----------------|
| Number             | Double         |
| String             | String         |
| Boolean            | Boolean        |
| null and undefined | null           |
| Node               | JsObject, Node |
| ArrayBuffer        | JsArrayBuffer  |
| Array              | JsArray        |
| Set                | JsSet          |
| Map                | JsMap          |
| Object             | JsObject       |
| Proxy Object       | Object         |

Proxy objects are mapped to the corresponding injected Java object.

Return

an Optional describing the value of the JavaScript object's property with the given name. If the object does not have this property or the property value is null or undefined, the method returns an empty Optional

Parameters

<T>

the result type according to the type mapping rules

name

a string that represents the name of the property or function

See also

Throws

when name is empty or blank

when the JavaScript object is already disposed or invalid